package b面向对象.day4.作业;

import java.util.Random;

public class Person {
    String name="小明";
    Market mk=new Market();
    Dog[]ds=new Dog[3];

    public void buyDog(){
        Random r=new Random();
        for(int i=0;i<ds.length;i++){
            int id;//0~9随机数//3,2,7
            do{
                id=r.nextInt(10);
            }while (mk.dogs[id]==null);
            //成功选择了狗，并从市场中取出
            ds[i]=mk.dogs[id];
            mk.dogs[id]=null;
        }
    }

    public void show(){
//        for (int i = 0; i < ds.length; i++) {
//
//        }
        for (Dog d:ds){
            System.out.println(name+"买到:"+d.name);
        }
    }
}
